//
//  JingXuanCell.m
//  autoHome
//
//  Created by MS on 15/9/11.
//  Copyright (c) 2015年 qf1523. All rights reserved.
//

#import "JingXuanCell.h"

@implementation JingXuanCell

- (void)awakeFromNib {
   
}

-(void)creatUI
{
    int i=0 ;
    i++;
   
    for (UIView *view  in self.contentView.subviews) {
        if (view.tag >100) {
            [view removeFromSuperview];
        }
        
    }
//    NSLog(@"---213123--%d",i);
    self.titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(115, 0, self.frame.size.width-50, 30)];
    self.titleLabel.tag = 101;
    self.titleLabel.font = [UIFont systemFontOfSize:15];
    [self.contentView addSubview:self.titleLabel];
    
    self.picImageView = [[UIImageView alloc] initWithFrame:CGRectMake(5, 5, 100, 75)];
    self.picImageView.tag = 100;
    
    [self.contentView addSubview:self.picImageView];
    
    self.bbsnameLabel = [[UILabel alloc] initWithFrame:CGRectMake(115, 50, 120, 30)];
    self.bbsnameLabel.tag = 102;
    [self.contentView addSubview:self.bbsnameLabel];
    
    self.replycountLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.contentView.frame.size.width-50, 50, 40, 30)];
    self.replycountLabel.font = [UIFont systemFontOfSize:12];
    self.replycountLabel.textAlignment = NSTextAlignmentRight;
    self.replycountLabel.tag = 103;
    self.bbsnameLabel.font = [UIFont systemFontOfSize:12];
    [self.contentView addSubview:self.replycountLabel];

}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];
    
 
 
}

-(void)configUIWithModel:(JingXuanModel *)model
{
    [self creatUI];
    
    [self.picImageView setImageWithURL:[NSURL URLWithString:model.smallpic] placeholderImage:[UIImage imageNamed:@"default_80_60"]];
    self.titleLabel.text = model.title;
    
    
    self.bbsnameLabel.text = model.bbsname;
    
    self.replycountLabel.text = [NSString stringWithFormat:@"%@回",[model.replycounts stringValue]];
}

@end
